package com.wuzf.demo.demo.bootstrap;

import com.wuzf.demo.demo.service.CalculateService;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;

@ComponentScan("com.wuzf.demo.service")
public class CalculateBootstrap {

    public static void main(String[] args) {
        ConfigurableApplicationContext context = new SpringApplicationBuilder(CalculateBootstrap.class)
                .web(WebApplicationType.NONE)
                .profiles("java7")
                .run(args);

        CalculateService service =
                context.getBean(CalculateService.class);
        System.out.println(service.sum(1, 2, 3, 4, 5, 6, 7, 8, 9, 10));
        // 关闭
        context.close();
    }

}
